Skip to content

Conversation

@camille-bouvy-frequenz
Copy link
Contributor

This PR integrates the Public Order Book extension to the Client. More specifically, the changes made are:

  • Add the PublicOrder and PublicOrderFilter types
  • Add the receive_public_order() endpoint
  • Update the frequenz-api-electricity-trading to >= 0.6.1, < 0.7.0

Copilot AI review requested due to automatic review settings April 3, 2025 09:59
@camille-bouvy-frequenz camille-bouvy-frequenz requested a review from a team as a code owner April 3, 2025 09:59
@github-actions github-actions bot added part:docs Affects the documentation part:tooling Affects the development tooling (CI, deployment, dependency management, etc.) labels Apr 3, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR integrates the Public Order Book extension into the Client. It adds new types PublicOrder and PublicOrderFilter, implements a new endpoint to stream public orders, and updates the dependency for the electricity trading API.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/frequenz/client/electricity_trading/_types.py Added PublicOrder and PublicOrderFilter types with relevant conversion methods.
src/frequenz/client/electricity_trading/_client.py Introduced the receive_public_orders endpoint and maintained the streaming logic for public orders.
pyproject.toml Updated the dependency for frequenz-api-electricity-trading to the new version constraints.
RELEASE_NOTES.md Updated release notes to document dependency changes and the addition of the Public Order Book extension.
Comments suppressed due to low confidence (1)

src/frequenz/client/electricity_trading/_client.py:977

  • The endpoint function name 'receive_public_orders' is inconsistent with the PR description using the singular 'receive_public_order()'. Consider renaming for consistency.
def receive_public_orders(

Copy link
Contributor

@matthias-wende-frequenz matthias-wende-frequenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now I've added two small comments. Can you also please add tests?



@dataclass()
class PublicOrderFilter:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to call it PublicOrderBookFilter, because it's used to filter entries in the order book and not filter single orders.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that in the Client it's called PublicOrder I wouldn't. Or we write add *Book everywhere but imo for consistency in the API it's best to not include it in the names.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the client a single entry is called a public order. This class is used as a parameter for an rpc call to query a list of public orders.

raise
return self._public_trades_streams[public_trade_filter]

def receive_public_orders(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to call this receive_public_order_book and not differ from API terminology.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Same as above)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This receives a stream of public orders, which together form a order book. We should be consistent across client and API. (Also this is a term this is officially in use so we should stick to established terminology).

@camille-bouvy-frequenz
Copy link
Contributor Author

Can you also please add tests?

Ah yes good call, will do!

* Add the PublicOrder and PublicOrderFilter types
* Add the receive_public_order() endpoint
* Update the frequenz-api-electricity-trading to >= 0.6.1, < 0.7.0

Signed-off-by: camille-bouvy-frequenz <[email protected]>
Signed-off-by: camille-bouvy-frequenz <[email protected]>
@github-actions github-actions bot added the part:tests Affects the unit, integration and performance (benchmarks) tests label Apr 8, 2025
@camille-bouvy-frequenz
Copy link
Contributor Author

camille-bouvy-frequenz commented Apr 8, 2025

Fixed the names (as discussed in previous comments and in our call) and added tests.

@matthias-wende-frequenz matthias-wende-frequenz added this pull request to the merge queue Apr 17, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 17, 2025
@matthias-wende-frequenz matthias-wende-frequenz added this pull request to the merge queue Apr 17, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 17, 2025
@matthias-wende-frequenz matthias-wende-frequenz linked an issue Apr 22, 2025 that may be closed by this pull request
@matthias-wende-frequenz matthias-wende-frequenz added this pull request to the merge queue Apr 22, 2025
Merged via the queue into frequenz-floss:v0.x.x with commit 04f5253 Apr 22, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:docs Affects the documentation part:tests Affects the unit, integration and performance (benchmarks) tests part:tooling Affects the development tooling (CI, deployment, dependency management, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Public Order Book API Extension

3 participants